package com.asset.salesforce.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import org.springframework.beans.factory.annotation.Autowired;

import com.asset.salesforce.service.EmployeeService;


public class EmployeeNotExistConstraintValidator implements ConstraintValidator<EmployeeNotExist, Object> {

	@Autowired
	EmployeeService employeeService;
	
	public void initialize(EmployeeNotExist arg0) {
		// TODO Auto-generated method stub
		
	}

	public boolean isValid(Object target, ConstraintValidatorContext arg1) {
		if(employeeService.getEmployeeByEmail((String) target) != null){
			return false;
		}else{
			return true;
		}
	}
	
}
	 